package com.zkthink.ceres.common.enums;

import com.zkthink.exception.BizException;
import lombok.Getter;

/**
 * @Author Xiaoyan
 * @create 2021/12/16 9:58
 */
@Getter
public enum RedSourceAdditionAndSubtractionTypeEnum {
    SUBTRACTION(0, "减"),
    ADDITION(1, "加");
    private int code;

    private String desc;

    RedSourceAdditionAndSubtractionTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static RedSourceAdditionAndSubtractionTypeEnum getDscByType(Integer type) {
        for (RedSourceAdditionAndSubtractionTypeEnum p : values()) {
            if (p.getCode() == type.intValue()) {
                return p;
            }
        }
        throw new BizException("no support promotionPlan");
    }
}
